package cn.lili.controller.feign.system;

import cn.lili.modules.other.service.CustomWordsService;
import cn.lili.modules.search.client.CustomWordsClient;
import cn.lili.modules.search.entity.dos.CustomWords;
import cn.lili.modules.search.entity.params.CustomWordsParams;
import cn.lili.modules.search.entity.vo.CustomWordsVO;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author: ftyy
 * @date: 2021-12-25 18:20
 * @description: 自定义分词 feign client
 */
@RestController
@RequiredArgsConstructor
public class CustomWordsFeignController implements CustomWordsClient {

    private final CustomWordsService customWordsService;

    @Override
    public String deploy() {
        return customWordsService.deploy();
    }

    @Override
    public boolean addCustomWords(CustomWordsVO customWordsVO) {
        return customWordsService.addCustomWords(customWordsVO);
    }

    @Override
    public void addCustomWordsList(List<CustomWords> customWordsList) {
        customWordsService.insertBatchCustomWords(customWordsList);
    }

    @Override
    public boolean updateCustomWords(CustomWordsVO customWordsVO) {
        return customWordsService.updateCustomWords(customWordsVO);
    }

    @Override
    public boolean deleteCustomWords(String id) {
        return customWordsService.deleteCustomWords(id);
    }

    @Override
    public boolean deleteBathByName(List<String> names) {
        return customWordsService.deleteBathByName(names);
    }

    @Override
    public Page<CustomWords> getCustomWordsByPage(CustomWordsParams customWordsParams) {

        return customWordsService.getCustomWordsByPage(customWordsParams.getWords(), customWordsParams.getPageVo());
    }
}
